#!/bin/sh
old_url="http://xxx.xxx.xxx.xxx:xxx"
old_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
old_repos_owner="xxx"
new_url="http://xxx.xxx.xxx.xxx:xxx"
new_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
new_repos_owner="xxx"

repos_list=$@
for repo in ${repos_list};do
    echo ${repo}
    curl -X 'POST' ${new_url}'/api/v1/repos/migrate?token='${new_token}'' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{ "auth_token": "'${old_token}'", "auth_username": "'${old_repos_owner}'", "clone_addr": "'${old_url}'/'${old_repos_owner}'/'${repo}'", "repo_name": "'${repo}'", "repo_owner": "'${new_repos_owner}'"}'
done